home *** CD-ROM | disk | FTP | other *** search
/ Alpha CD-ROM Bonus Pack / Alpha CD-ROM Bonus Pack.iso / life / shared.dir / 00493_Utility Functions.ls next >
Encoding:
Text File  |  1995-01-16  |  1.9 KB  |  108 lines

  1. on unPuppetSprites first, last
  2.   if (last < first) or (first <= 0) or (last >= 48) then
  3.     return 0
  4.   else
  5.     repeat with i = first to last
  6.       puppetSprite(i, 0)
  7.     end repeat
  8.     return 1
  9.   end if
  10. end
  11.  
  12. on deleteLastComma theLine
  13.   if char length(theLine) of theLine = "," then
  14.     delete char length(theLine) of theLine
  15.   end if
  16.   return theLine
  17. end
  18.  
  19. on stripCR theString
  20.   if char length(theString) of theString = RETURN then
  21.     delete char length(theString) of theString
  22.   end if
  23.   return theString
  24. end
  25.  
  26. on stripLeadingSpaces theLine
  27.   set theLine to stripCR(theLine)
  28.   set len to length(theLine)
  29.   repeat with n = 1 to len
  30.     if chars(theLine, n, n) <> " " then
  31.       exit repeat
  32.     end if
  33.   end repeat
  34.   return chars(theLine, n, len)
  35. end
  36.  
  37. on copyList from
  38.   set temp to []
  39.   repeat with i = 1 to count(from)
  40.     add(temp, getAt(from, i))
  41.   end repeat
  42.   return temp
  43. end
  44.  
  45. on quoteIt theString
  46.   if char 1 of theString = QUOTE then
  47.     delete char 1 of theString
  48.   end if
  49.   if char length(theString) of theString = QUOTE then
  50.     delete char length(theString) of theString
  51.   end if
  52.   repeat with i = 1 to length(theString)
  53.     if char i of theString = QUOTE then
  54.       put "'" into char i of theString
  55.     end if
  56.   end repeat
  57.   set theString to QUOTE & theString & QUOTE
  58.   return theString
  59. end
  60.  
  61. on makeButtonClickSound
  62.   puppetSound("MouseDwn.AIF")
  63.   updateStage()
  64.   repeat while soundBusy(1)
  65.   end repeat
  66.   puppetSound(0)
  67. end
  68.  
  69. on killSound
  70.   if soundBusy(1) then
  71.     puppetSound(0)
  72.   end if
  73. end
  74.  
  75. on debug theString
  76.   if debugModeOn() then
  77.     put theString
  78.   end if
  79. end
  80.  
  81. on debugModeOn
  82.   global gDebugMode
  83.   return gDebugMode
  84. end
  85.  
  86. on setDebugMode theState
  87.   global gDebugMode
  88.   set gDebugMode to theState
  89. end
  90.  
  91. on getX point
  92.   return getAt(point, 1)
  93. end
  94.  
  95. on getY point
  96.   return getAt(point, 2)
  97. end
  98.  
  99. on changeCursor theCursor
  100.   if theCursor = EMPTY then
  101.     cursor(200)
  102.     updateStage()
  103.   else
  104.     cursor(-1)
  105.     updateStage()
  106.   end if
  107. end
  108.